<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1_$rootScope</title>
    <script src="../lib/angularjs.js"></script>
</head>

<body ng-app="myApp" ng-controller="myCtrl">
    <div ng-controller="outerCtrl1"></div>
    <div ng-controller="outerCtrl2"></div>
</body>
<script>
    const myApp = angular.module("myApp", [])
    myApp.controller("myCtrl", ["$scope", "$rootScope", function ($scope, $rootScope) {
        $rootScope.title = "root scope"
        $scope.title = "body scope"
        console.log("myCtrl-$scope：", $scope);
        console.log("myCtrl-$rootScope：", $rootScope);
    }])
    myApp.controller("outerCtrl1", ["$scope", "$rootScope", function ($scope, $rootScope) {
        console.log("outerCtrl1-$scope：", $scope);
        console.log("outerCtrl1-$rootScope：", $rootScope);
    }])
    myApp.controller("outerCtrl2", ["$scope", "$rootScope", function ($scope, $rootScope) {
        console.log("outerCtrl2-$scope：", $scope);
        console.log("outerCtrl2-$rootScope：", $rootScope);
    }])
</script>

</html>